#include <stdio.h>

/** 本例演示递归调用
// 在x86_64平台上打出来的日志是这样的：
Level 1: n location 0x7fff5c4b6a4c
Level 2: n location 0x7fff5c4b6a2c
Level 3: n location 0x7fff5c4b6a0c
Level 4: n location 0x7fff5c4b69ec
LEVEL 4: n location 0x7fff5c4b69ec
LEVEL 3: n location 0x7fff5c4b6a0c
LEVEL 2: n location 0x7fff5c4b6a2c
LEVEL 1: n location 0x7fff5c4b6a4c
// 由打出来的日志来看，我们每次是少了32字节，为什么会这样呢？
// 我的猜测是因为返回地址占8字节，rbp占8字节，然后分配参数占了16字节，到底是不是这样，看汇编
*/
void up_and_down(int);
int main(void)
{
    up_and_down(1);
    return 0;
}
void up_and_down(int n)
{
    printf("Level %d: n location %p\n", n, &n); // #1
    if (n < 4)
        up_and_down(n + 1);
    printf("LEVEL %d: n location %p\n", n, &n); // #2
}